package org.example.reflect_demo;

public class User {
    private String name;
    private int age;
    public String gender; // 新增公共属性用于测试

    // 无参构造
    public User() {}

    // 有参构造
    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    // Getter/Setter
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public int getAge() { return age; }
    public void setAge(int age) { this.age = age; }

    // 私有方法
    private void printInfo() {
        System.out.println("Name: " + name + ", Age: " + age);
    }

    // 带参数的公共方法
    public void updateInfo(String newName, int newAge) {
        this.name = newName;
        this.age = newAge;
    }
}